﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Windows8Accelerator.Core.Xaml.Html
{
    public class SuperHtmlNode
    {
        public bool IsText { get; set; }
        public string TagName { get; set; }
        public Func<IEnumerable<SuperHtmlNode>> GetChildNodes { get; set; }
        public Func<IEnumerable<Tuple<string, string>>> GetAttributes { get; set; }
        public string Text { get; set; }
        private Dictionary<string, string> _Attributes;
        public Dictionary<string, string> Attributes
        {
            get
            {
                if (_Attributes != null)
                    return _Attributes;
                _Attributes = new Dictionary<string, string>();
                foreach (var item in GetAttributes())
                {
                    _Attributes[item.Item1] = item.Item2;
                }
                return _Attributes;
            }
        }
    }

}
